package com.wfh.adapter;

import java.util.ArrayList;

import com.wfh.R;
import com.wfh.R.color;
import com.wfh.bean.ShopBean;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ShopsAdapter extends BaseAdapter {

	Context context;
	public ArrayList<ShopBean> list;
	
	// private static HashMap<Integer, Boolean> IsSelected = new
	// HashMap<Integer, Boolean>();

	public ShopsAdapter(Context context, ArrayList<ShopBean> list) {
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup arg2) {
		TextView textview=new TextView(context);
		textview.setText(list.get(position).getShop_name());
		textview.setTextSize(16);
		textview.setPadding(10, 15, 10, 15);
		textview.setGravity(Gravity.CENTER_VERTICAL);
		textview.setTextColor(Color.BLACK);
		return textview;
	}

	

	public void refresh(ArrayList<ShopBean> list) {
		this.list = list;
		notifyDataSetChanged();
	}

}
